import App from '../App.vue'
const home = r => require.ensure([], () => r(require('../page/home/home')), 'home')
const city = r => require.ensure([], () => r(require('../page/city/city')), 'city')
const msite = r => require.ensure([], () => r(require('../page/msite/msite')), 'msite')
const food = r => require.ensure([], () => r(require('../page/food/food')), 'food')
const shop = r => require.ensure([], () => r(require('../page/shop/shop')), 'shop')
const search = r => require.ensure([], () => r(require('../page/search/search')), 'search')
const foodDetail = r => require.ensure([], () => r(require('../page/shop/foodDetail')), 'foodDetail')
const shopDetail = r => require.ensure([], () => r(require('../page/shop/shopDetail')), 'shopDetail')
const shopSafe = r => require.ensure([], () => r(require('../page/shop/children/shopSafe')), 'shopSafe')
const confirmOrder = r => require.ensure([], () => r(require('../page/confirmOrder/confirmOrder')), 'confirmOrder')
const order = r => require.ensure([], () => r(require('../page/order/order')), 'order')
const login = r => require.ensure([], () => r(require('../page/login/login')), 'login')
const invoice = r => require.ensure([], () => r(require('../page/confirmOrder/children/invoice')), 'invoice')
const payment = r => require.ensure([], () => r(require('../page/confirmOrder/children/payment')), 'payment')
const remark = r => require.ensure([], () => r(require('../page/confirmOrder/children/remark')), 'remark')
const choosedAddress = r => require.ensure([], () => r(require('../page/confirmOrder/children/choosedAddress')), 'choosedAddress')
const addAddress = r => require.ensure([], () => r(require('../page/confirmOrder/children/children/addAddress')), 'addAddress')
const searchAddress = r => require.ensure([], () => r(require('../page/confirmOrder/children/children/children/searchAddress')), 'searchAddress')
const profile = r => require.ensure([], () => r(require('../page/profile/profile')), 'profile')
const info = r => require.ensure([], () => r(require('../page/profile/children/info')), 'info')
const setusername = r => require.ensure([], () => r(require('../page/profile/children/children/setusername')), 'setusername')
const address = r => require.ensure([], () => r(require('../page/profile/children/children/address')), 'address')
const add = r => require.ensure([], () => r(require('../page/profile/children/children/children/add')), 'add')
const addDetail = r => require.ensure([], () => r(require('../page/profile/children/children/children/children/addDetail')), 'addDetail')
export default [{
    path: '/',
    component: App, // 项目路由 对应index.html
    children: [ // 二级路由 对应app.vue
        // 地址为空时跳转home页面
        {
            path: '',
            redirect: '/home'
        },
        // 首页城市列表页
        {
            path: '/home',
            component: home
        },
        // 当前选择城市页
        {
            path: '/city/:cityid',
            component: city
        },
        // 所有商铺列表页
        {
            path: '/msite',
            component: msite
        },
        // 特色商铺列表
        {
            path: '/food',
            component: food
        },
        // 商铺详情页
        {
            path: '/shop',
            component: shop,
            children: [{
                    path: 'foodDetail', // 食品详情页
                    component: foodDetail
                },
                {
                    path: 'shopDetail', // 商铺详情页
                    component: shopDetail,
                    children: [{
                        path: 'shopSafe', // 商铺安全认证页
                        component: shopSafe
                    }]
                },
            ]
        },
        // 搜索页面
        {
            path: '/search/:geohash',
            component: search
        },
        //确认订单页
        {
            path: '/confirmOrder',
            component: confirmOrder,
            children: [{
                    path: 'invoice',
                    component: invoice //发票抬头
                },
                {
                    path: 'payment',
                    component: payment, // 付款页面
                },
                {
                    path: 'remark',
                    component: remark, // 订单备注
                },
                {
                    path: 'chooseAddress',
                    component: choosedAddress, // 选择地址页
                    children: [{
                        path: 'addAddress',
                        component: addAddress, // 添加地址
                        children: [{
                            path: 'searchAddress',
                            component: searchAddress, // 搜索收获地址
                        }]
                    }]
                }
            ]
        },
        // 订单列表页
        {
            path: '/order',
            component: order
        },
        // 登录注册页
        {
            path: '/login',
            component: login
        },
        // 个人信息页
        {
            path: '/profile',
            component: profile,
            children: [{
                    path: 'info',
                    component: info, // 个人信息详情页
                    children: [{
                        path: 'setusername',
                        component: setusername, // 修改用户名
                    }, {
                        path: 'address',
                        component: address, // 个人中心的收获地址
                        children: [{
                            path: 'add',
                            component: add, // 编辑地址
                            children: [{
                                path: 'addDetail',
                                component: addDetail, // 搜索位置
                            }]
                        }]
                    }]
                },

            ]
        }
    ]
}]
